platform :ios, '12.0'
use_modular_headers!
inhibit_all_warnings!     # 屏蔽pod中告警
require "fileutils"

abstract_target 'GithubClient' do
  
target 'Fixed RepoExtension' do
  pod 'Kanna', '~> 5.2.2'
  pod 'ObjectMapper'
  pod 'Alamofire'
end

target 'ZLGitHubClient' do
 
pod "SYDCentralPivot"

pod 'ZLGithubOAuth', :git => 'https://github.com/ExistOrLive/ZLGithubOAuth.git', :tag => "1.3.1"
#pod "ZLGithubOAuth", :path => '../../ZLGithubOAuth'

pod 'ZLGitRemoteService', :git => 'https://github.com/ExistOrLive/ZLGitRemoteService.git', :tag => "1.7.1"
#pod "ZLGitRemoteService", :path => '../../ZLGitRemoteService'

pod 'ZLBaseExtension', :git => "https://github.com/ExistOrLive/ZLBaseExtension.git", :tag => "1.3.0"
# 'ZLBaseExtension', :path => "../../ZLBaseExtension"

pod 'ZLUIUtilities', :git => "https://github.com/ExistOrLive/ZLUIUtilities.git", :tag => "1.3.0"
#pod 'ZLUIUtilities', :path => "../../ZLUIUtilities"

#pod 'ZLUtilities', :path => '../../ZLUtilities'
pod 'ZLUtilities', :git => "https://github.com/ExistOrLive/ZLUtilities.git", :tag => "1.3.0"

#pod 'ZMMVVM', :path => '../../ZMMVVM'
pod 'ZMMVVM', :git => "https://github.com/ExistOrLive/ZMMVVM.git", :tag => "1.3.0"

pod 'Umbrella'
pod 'Umbrella/Firebase'


# 刷新控件
pod 'MJRefresh'
# 转圈控件
pod 'MBProgressHUD', :git => "https://github.com/jdg/MBProgressHUD.git"
# ToastView https://github.com/scalessec/Toast-Swift
pod 'Toast-Swift'
# pageView控件 https://github.com/pujiaxin33/JXSegmentedView
pod 'JXSegmentedView'
# 键盘 https://github.com/hackiftekhar/IQKeyboardManager
pod 'IQKeyboardManager'
# 图表
pod 'DGCharts'
#下载图片
pod 'SDWebImage'
# AutoLayout
pod 'Masonry'
#pod 'SnapKit'

pod 'YYText'

# 弹出框容器
pod 'FFPopup'


#pod 'MMMarkdown'
#pod 'MarkdownView'



# 移动监控工具
pod 'WoodPeckeriOS', :configurations => ['Debug']
pod 'LookinServer', :configurations => ['Debug']
#pod 'DoraemonKit/Core', :configurations => ['Debug']
#pod 'DoraemonKit/WithLogger', :configurations => ['Debug']
#pod 'GCDWebServer', :configurations => ['Debug'], :git => "https://github.com/readium/GCDWebServer.git", :tag => '3.6.3'
#pod 'DoraemonKit/WithGPS', :configurations => ['Debug']
#pod 'DoraemonKit/WithMLeaksFinder', :configurations => ['Debug']

# 异常防护
pod 'JJException'

# 扩展
pod 'UITextView+Placeholder'

# 转场动画
#pod 'Hero'

# 物理引擎动画
#pod 'pop', '~> 1.0'

# 弹出框 弹出菜单
pod 'FWPopupView'

# 圆形菜单
pod 'CircleMenu'

# 浮动view https://github.com/scenee/FloatingPanel
#pod 'FloatingPanel'

# firebase 分析监控
pod 'Firebase/Analytics', "= 10.22.0"
pod 'Firebase/Crashlytics', "= 10.22.0"
pod 'Firebase/Performance', "= 10.22.0"


end


post_install do |installer|
  ## fix oclint issue : one compiler command contains multiple jobs
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      ## fix  CocoaPod config to solve XCode 14, iOS16 Requires a development team. Select a development team in the Signing & Capabilities editor https://stackoverflow.com/questions/73811360/cocoapod-config-to-solve-xcode-14-ios16-requires-a-development-team-select-a-d
      if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
        target.build_configurations.each do |config|
          config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
          config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
          config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
        end
      end
      config.build_settings['COMPILER_INDEX_STORE_ENABLE'] = "NO"
      if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 12.0
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
      end
    end
  end
    
    ## Fix for XCode 12.5
    find_and_replace("Pods/FBRetainCycleDetector/FBRetainCycleDetector/Layout/Classes/FBClassStrongLayout.mm","layoutCache[currentClass] = ivars;", "layoutCache[(id<NSCopying>)currentClass] = ivars;")
end

end


def find_and_replace(dir, findstr, replacestr)
  Dir[dir].each do |name|
      FileUtils.chmod("+w", name) #add
      text = File.read(name)
      replace = text.gsub(findstr,replacestr)
      if text != replace
          puts "Fix: " + name
          File.open(name, "w") { |file| file.puts replace }
          STDOUT.flush
      end
  end
  Dir[dir + '*/'].each(&method(:find_and_replace))
end
